package net.lahuobao.export.service.impl;

import java.io.IOException;
import java.io.Writer;
import java.util.List;

import javax.servlet.http.HttpServletResponse;

import org.jeecgframework.core.common.service.impl.CommonServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Service;

import net.lahuobao.export.service.comm.IStreamGen;
import net.lahuobao.export.service.stream.ITxtGen;
/**
 * 文件生成
 * @author Administrator
 *
 */
@Service("txtStreamGenService")
@Scope("prototype")
public class TxtStreamGenImpl extends CommonServiceImpl implements IStreamGen {
	@Autowired
	private ITxtGen txtGenService;
	@Override
	public <T>boolean createStream(Writer writer, String type,HttpServletResponse response,List<T> dataList,int limit,int index) throws IOException, InstantiationException, IllegalAccessException {
		boolean flag=false;//判断记录是否有limit条
		if(type.equals("txt")){
			flag=txtGenService.createStream(writer,response,dataList,limit,index);
		}
		return flag;
	}
	
	
	
	@Override
	public void init() {
		// TODO Auto-generated method stub
		
	}
	
	
	
	@Override
	public void finish(HttpServletResponse response) {
		// TODO Auto-generated method stub
		
	}
	
	
	
}
